HAL TIM state and error functions migration

This section provides information about the HAL TIM state functions migration.

HAL TIM process getState functions

HAL1

HAL2

get state function

  • In HAL1, each process has its own GetState function:

    • HAL_TIM_Base_GetState(&htim) for the base timer.

    • HAL_TIM_OC_GetState(&htim) for the output compare.

    • HAL_TIM_PWM_GetState(&htim) for the PWM.

    • HAL_TIM_IC_GetState(&htim) for the input capture.

    • HAL_TIM_OnePulse_GetState(&htim) for the one-pulse mode.

    • HAL_TIM_Encoder_GetState(&htim) for the encoder interface.

  • In contrast, HAL2 simplifies this by replacing all these individual functions with a single function :

    • HAL_TIM_GetState(&htim)

Related concept:


HAL TIM get channel state

HAL1

HAL2

HAL_TIM_ChannelStateTypeDef HAL_TIM_GetChannelState(const TIM_HandleTypeDef *htim, uint32_t Channel);
hal_tim_channel_state_t HAL_TIM_GetChannelState(const hal_tim_handle_t *htim, hal_tim_channel_t channel);

HAL TIM get channel state

HAL1

HAL2

HAL_TIM_DMABurstStateTypeDef HAL_TIM_DMABurstState(const TIM_HandleTypeDef *htim);

In HAL2, does not expose a separate DMA burst state API; DMA burst control is managed through :

  • HAL_TIM_SetConfigDMABurst

  • HAL_TIM_StartDMABurst

  • HAL_TIM_StopDMABurst